<?php
	$query = "Select * from `news` where `cat`='0' order by `time` desc limit 1";
	$result 		=	 mysql_query($query);
  
  xmlwriter_start_element($xml,"news");
	if (mysql_num_rows($result)) {
		if ($news = mysql_fetch_assoc($result)){

      xmlwriter_write_element($xml,"lang",	  $news['lang'] );	   
      xmlwriter_write_element($xml,"timestamp",	    $news['time'] );
      xmlwriter_write_element($xml,"timeformatted",	date("d-m-Y H:i:s",$news['time']));
			if ($news['edited'] != 0 ) {
        xmlwriter_write_element($xml,"edittimestamp",	    $news['edited'] );
        xmlwriter_write_element($xml,"edittimeformatted",	date("d-m-Y H:i:s",$news['edited']));
      }
      xmlwriter_write_element($xml,"subject",	    $news['subject'] );
      xmlwriter_write_element($xml,"text",	    $news['text'] );

		}
	} 
  xmlwriter_end_element($xml);
?>
